#!/bin/bash

# Inkscape-Definitions-Cleaner

echo "Cleaning definitions could take up to 2 minutes.";
echo;

echo -n "Cleaning vacuum definitions.(1 of 1)..............."; #cleaning vacuum definitions (inkscape command)
cd $SOURCES;                                               #move to scalable directory (where svg are contained)
SCALABLE=`find ./ -name *.svg -type f`;                    #find all the files that are svg
for file in $SCALABLE                                      #for that files do...
do
	inkscape --without-gui --file=$file  --vacuum-defs > InkscapeCleaningOutput.tmp 2>&1 #clean all unused definitions
done  
rm -f InkscapeCleaningOutput.tmp
echo "[DONE]";
echo "Cleaning process completed.";
echo;

exit 0
